package structuralModel.combinationModel;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述: 院系信息
 * 2024/02/09
 *
 * @see CombinationCompoent
 * ZhangYi
 */
public class University extends CombinationCompoent{

    /**
     * 所有的院系
     */
    private List<CombinationCompoent> components = new ArrayList<>();

    public University(String name,
                      String desc) {
        super(name,
              desc);
    }


    @Override
    protected void addElement(CombinationCompoent e) {
        components.add(e);
    }

    @Override
    protected void removeElement(CombinationCompoent e) {
        components.remove(e);
    }


    public void queryAll() {
        // 这里迭代的是 院系
        System.out.println("================="+getDesc()+"===============");
        for (CombinationCompoent e : components){
            e.queryAll();
        }
    }
}
